<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}

class table_city_square_all extends common_table
{
	public function __construct() {

		$this->_table = 'city_square_all';
		$this->_pk    = 'sid';

		parent::__construct();
	}
	public function fetch_all_by_sid($sid){
		if(!empty($sid)&&$sid){
			return DB::fetch_all('SELECT * FROM %t WHERE sid=%s',array($this->_table,$sid));//返回数组包含各个字段的值
		}
		return false;
	}
	
	public function delete_all_by_sid($sid,$limit="",$unbuffered = true){//按主键删除
		if(!empty($sid)&&$sid){
			$condition=$this->_pk."='".$sid."'";
			return DB::delete($this->_table,$condition,limit,$unbuffered = true);//返回受影响的行数
		}
		return false;
	}
	public function update_by_sid($sid,$data,$unbuffered = false, $low_priority = false){
		if(!empty($sid) && !empty($data)){
			$condition=$this->_pk."='".$sid."'";
			return DB::update($this->_table,$data,$condition,$unbuffered,$low_priority);//返回前一次 MySQL 操作所影响的记录行数
		}
		return false;
	}
	public function insert($data, $return_insert_id = false, $replace = false, $silent = false){
		if(!empty($data)){
			return DB::insert($this->_table,$data, $return_insert_id,$replace,$silent);//返回上一步 INSERT 操作产生的 ID
		}
		return false;
		
	}
	

	
}

?>